﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace AttributeDoem
{
    /// <summary>
    /// 校验密码格式是否正确【6-15位数字与字母的组合】
    /// </summary>
    public class PasswordAttribute : BaseVerifyAttribute
    {
        public override bool GetVerifyInfo(object value)
        {
            if (value == null)
            {
                throw new Exception("空指针");
            }
            Regex reg = new Regex("^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,15}$");
            return reg.IsMatch(value.ToString());
        }
    }
}
